package main

import (
	"goods_srv/global"
	"goods_srv/model"
)

func main() {
	goods := model.Goods{
		Name:       "小米",
		CategoryId: 3,
		Category: model.Category{
			CategoryName:     "手机",
			ParentCategoryId: 1,
		},
		Logo:      "1.png",
		Price:     10,
		Image:     "2.png",
		CommentId: 1,
		Comment: model.Comment{
			GoodsId:  3,
			Comments: "很好用",
		},
		Stock: 100,
	}
	global.DB.Preload("Category").Preload("Comment").Save(&goods)
}
